package br.com.edoc.gerentes;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import sun.misc.BASE64Encoder;
import br.com.edoc.excecoes.ExceptionApplication;

public class GerenteSeguranca {
	public static String encriptaSenha(String string) throws ExceptionApplication{
		
		try{
			MessageDigest digest = MessageDigest.getInstance("MD5");
			digest.update(string.getBytes());
			BASE64Encoder encoder = new BASE64Encoder();
			return encoder.encode(digest.digest());
		}catch (NoSuchAlgorithmException ns) {
			// TODO: handle exception
			ns.printStackTrace();
			throw new ExceptionApplication("Erro ao Encriptar Senha");
		}
		
	}

}